# -*- coding: utf-8 -*-

"""
Created on 11/17/2021
gogogo.
@author: Kang Xiatao (kangxiatao@gmail.com)
"""
from copy import deepcopy

"""
nohup python gogogo.py > logs/gogogo.txt 2>&1 &
CUDA_VISIBLE_DEVICES=0 nohup python gogogo.py > /dev/null 2>&1 &
"""

import os
import time

print('gogogo')

def run_fun(cmd='', run_check=False):
    while True:
        start_time = time.time()
        print(cmd)
        os.system(cmd)
        if not run_check:
            break
        if time.time() - start_time > 600:  # 至少十分钟
            break
    # time.sleep(1 * 60)

# time.sleep(1 * 60 * 60 + 30 * 60)

run_fun("python -u main.py --env_name 6h_vs_8z --mode medium --seed 0 --n_epochs 50")
run_fun("nohup python -u main.py --env_name 6h_vs_8z --mode medium_replay --seed 0 --n_epochs 50 > /dev/null 2>&1 &")

run_fun("python -u main.py --env_name 5m_vs_6m --mode medium --seed 0 --n_epochs 50")
run_fun("nohup python -u main.py --env_name 5m_vs_6m --mode medium_replay --seed 0 --n_epochs 50 > /dev/null 2>&1 &")


time.sleep(0.5 * 60 * 60)

run_fun("shutdown -h now")


